/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author jonatan
 */
public class EMF {

    private static EntityManagerFactory emf = null;
    private static EntityManager em = null;

    public EMF() {
    }
    
    public static EntityManager getEntityManager(){
                if(em==null){
                        emf = Persistence.createEntityManagerFactory("LivrariaPU");
                        em=emf.createEntityManager();
                        return em;
                }
                else return em;
        }
        
}
